""" the __new__ method must return an instance of the class
since __init__ calls are not implicitly called in subclassed, __new__ can
be used to make sure that an initialization is done throughout the class
hierarchy.

network socket or database initializations ,should be controlled in 
__new__ rather than in __init__. 

"""
class MyClass(object):
    def __new__(cls):
        print '__new__ called'
        return object.__new__(cls)
    def __init__(self):
        print '__init__ called'
        self.a=1

class MyOtherClass(MyClass):
    def __init__(self):
        print 'my otherclass __init__ called'
        super(MyOtherClass,self).__init__()
        self.b=2
instan = MyClass()
other = MyOtherClass()
